<template>
  <div class="products-class-container">
    <div class="van-row">
    <div class="van-col van-col--8">
      <van-list
        v-model="loading"
        :finished="finished"
        @load="onLoad"
        v-bind:style="{height: listHeight+'px'}"
      >
        <van-cell v-for="item in list" :key="item" :title="item + ''" />
      </van-list>
    </div>

    <div class="van-col van-col--16">
      <van-list
        v-model="loading"
        :finished="finished"
        @load="onLoad"
				v-bind:style="{height: listHeight+'px'}"
      >
        <van-cell v-for="item in list" :key="item" :title="item + ''" />
      </van-list>
    </div>
  </div>
  </div>
</template>

<script>
import { Row, Col, List, Cell } from 'vant';

export default {
  components: {
    [Row.name]: Row,
    [Col.name]: Col,
    [Cell.name]: Cell,
    [List.name]: List
  },
  data() {
    return {
      list: [],
      loading: false,
      finished: false,
      listHeight: 200
    };
  },
  mounted() {
    this.listHeight = document.body.clientHeight;
  },
  methods: {
    onLoad() {
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.list.push(this.list.length + 1);
        }
        this.loading = false;

        if (this.list.length >= 40) {
          this.finished = true;
        }
      }, 500);
    }
  }
};

</script>

<style>
.products-class-container .van-list {
  overflow: scroll;
  padding-bottom:50px;
}
</style>
